%
% Constructing a cube from a rectangle
%
% States of agents are: 
% - I=Inactive, for initialitation
% - E=East, for agents that should bo east
% - W=West, for agents that should go west
% - S=Stop, for agents that got to their final destination
%
% Counters are:
% - C1 contains the relative x-coordinates to the rectangle start
% - C2 contains the relative y-coordinates to the rectangle end
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Activate East
1
SI**** <C001 0000
SE****

Activate West
1
SI**** >C002 0000
SW****

North East 
1
SE**** <C001 0000 E-1,0,0 E0,1,0 E1,1,0 F1,0,0 !T2,1,0,W****     
P1,1,0 C001 + C001 0001 C002 + C002 0001

North West 
1
SW**** >C002 0000 E1,0,0 E0,1,0 E-1,1,0 F-1,0,0 !T-2,1,0,E****
P-1,1,0 C001 - C001 0001 C002 - C002 0001

East 
1
SE**** <C002 0000 F0,-1,0 F1,-1,0 E1,0,0 !T2,0,0,W**** 
P1,0,0 C001 + C001 0001 C002 + C002 0001

West 
1
SW**** >C001 0000 F0,-1,0 F-1,-1,0 E-1,0,0
P-1,0,0 C001 - C001 0001 C002 - C002 0001

NorthE
1
SE**** =C001 -0001 E0,1,0 F1,0,0 T1,1,0,I**** E-1,0,0
P0,1,0

NorthW
1
SW**** =C002 0001 E0,1,0 F-1,0,0 T-1,1,0,I**** E1,0,0
P0,1,0

South East
1
SE**** <C002 0000 F0,-1,0 E1,0,0 E1,-1,0
P1,-1,0 C001 + C001 0001 C002 + C002 0001

South West
1
SW**** >C001 0000 F0,-1,0 E-1,0,0 E-1,-1,0
P-1,-1,0 C001 - C001 0001 C002 - C002 0001

Stop East 1
1
SE**** =C002 0000
SI****

Stop West 1
1
SW**** =C001 0000
SI****

Deactivate East
1
SE**** <C002 0000 >C001 -0001 T1,0,0,I****
SI****

Deactivate West
1
SW**** >C001 0000 <C002 0001 T-1,0,0,I****
SI****

Deactivate West East
1
SW**** T1,0,0,E****
SI****

Deactivate East West
1
SE**** T1,0,0,W****
SI****
